.class public Lcom/ocpsoft/pretty/time/web/jsf/PrettyTimeConverter;
.super Ljava/lang/Object;
.source "PrettyTimeConverter.java"

# interfaces
.implements Ljavax/faces/convert/Converter;
.implements Ljava/io/Serializable;


# static fields
.field private static prettyTime:Lcom/ocpsoft/pretty/time/PrettyTime; = null

.field private static final serialVersionUID:J = 0x6aba0a0c7cf521a3L


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 17
    new-instance v0, Lcom/ocpsoft/pretty/time/PrettyTime;

    invoke-direct {v0}, Lcom/ocpsoft/pretty/time/PrettyTime;-><init>()V

    sput-object v0, Lcom/ocpsoft/pretty/time/web/jsf/PrettyTimeConverter;->prettyTime:Lcom/ocpsoft/pretty/time/PrettyTime;

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 13
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static getPrettyTime()Lcom/ocpsoft/pretty/time/PrettyTime;
    .locals 1

    .prologue
    .line 39
    sget-object v0, Lcom/ocpsoft/pretty/time/web/jsf/PrettyTimeConverter;->prettyTime:Lcom/ocpsoft/pretty/time/PrettyTime;

    return-object v0
.end method

.method public static setPrettyTime(Lcom/ocpsoft/pretty/time/PrettyTime;)V
    .locals 0
    .parameter "prettyTime"

    .prologue
    .line 48
    sput-object p0, Lcom/ocpsoft/pretty/time/web/jsf/PrettyTimeConverter;->prettyTime:Lcom/ocpsoft/pretty/time/PrettyTime;

    .line 49
    return-void
.end method


# virtual methods
.method public getAsObject(Ljavax/faces/context/FacesContext;Ljavax/faces/component/UIComponent;Ljava/lang/String;)Ljava/lang/Object;
    .locals 2
    .parameter "context"
    .parameter "comp"
    .parameter "value"

    .prologue
    .line 21
    new-instance v0, Ljavax/faces/convert/ConverterException;

    const-string v1, "Does not yet support converting String to Date"

    invoke-direct {v0, v1}, Ljavax/faces/convert/ConverterException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method public getAsString(Ljavax/faces/context/FacesContext;Ljavax/faces/component/UIComponent;Ljava/lang/Object;)Ljava/lang/String;
    .locals 3
    .parameter "context"
    .parameter "comp"
    .parameter "value"

    .prologue
    .line 26
    instance-of v0, p3, Ljava/util/Date;

    if-eqz v0, :cond_0

    .line 28
    sget-object v0, Lcom/ocpsoft/pretty/time/web/jsf/PrettyTimeConverter;->prettyTime:Lcom/ocpsoft/pretty/time/PrettyTime;

    check-cast p3, Ljava/util/Date;

    .end local p3
    invoke-virtual {v0, p3}, Lcom/ocpsoft/pretty/time/PrettyTime;->format(Ljava/util/Date;)Ljava/lang/String;

    move-result-object v0

    return-object v0

    .line 30
    .restart local p3
    :cond_0
    new-instance v0, Ljavax/faces/convert/ConverterException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "May only be used to convert java.util.Date objects. Got: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {p3}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljavax/faces/convert/ConverterException;-><init>(Ljava/lang/String;)V

    throw v0
.end method
